package at.fhj.itm10.ticketmaster.validators;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

/**
 * CheckboxValidator.
 * 
 * @author Sabrina Gruber
 * @author Tammo Boehme
 */

@FacesValidator(value = "CheckboxValidator")
public class CheckboxValidator implements Validator {

	public void validate(FacesContext context, UIComponent component, Object value)
			throws ValidatorException {
			
		if(value.equals(Boolean.FALSE)) {
				throw new ValidatorException(new FacesMessage("Bitte akzeptieren Sie die AGBs."));
		}
			
	}

}

